package com.corechina.apex_osswords.domain.dao;

import com.corechina.apex_osswords.domain.entity.SysUserGroupsMenu;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 用户分组菜单对应表 Mapper 接口
 * </p>
 *
 * @author cc
 * @since 2022-03-03
 */
@Component
public interface SysUserGroupsMenuMapper extends BaseMapper<SysUserGroupsMenu> {

    @Delete("delete from sys_user_groups_menu where menu_id = #{menuId}")
    int deleteByMenuId(@Param("menuId") Integer menuId);

    @Select("select menu_id from sys_user_groups_menu where group_id = #{groupId}")
    List<Integer> getMenuIdByGroupId(@Param("groupId") Integer groupId);

    @Delete("delete from sys_user_groups_menu where group_id = #{groupId}")
    int deleteByGroupId(@Param("groupId") Integer groupId);

    int insertByList(Map<String,Object> stringObjectMap);

}
